<!-- 视频分享的功能 -->
<%@ page language="java" pageEncoding="utf-8"%>
			
	<div style="margin-bottom:20px;">		
	<input id="video_input" name="" type="text"
				title="请复制视频地址到该地址栏.........."
				onblur=""
				onclick=""
				onkeypress=""
				onkeydown="" />
	
	<input type="button"  id="parseUrl" class="button"   value="解析视频地址">
	<div  id="previewViedo"></div>
	<span id="data-video-hidden"  data-video-hidden=""></span>
	</div>
	

<script type="text/javascript">

   $("#parseUrl").click(function(){
		  var url = $("#video_input").val();
		  if((/\S*tudou\S*/g).test(url))
		  {
			  //http://www.tudou.com/albumplay/5AKGsSvnSU8.html
			  var apiU = "http://api.tudou.com/v3/gw?method=repaste.info.get&appKey=f70c38b3b2a680a8&format=json&url=";
			  $.post("${ctx}/blog/blog.action", { "apiU": apiU,"url":url,"method:saveVideo":"xxxx","description":"博文视频地址的解析" },
		            function(data){
				      $("#video_input").val("");
                 	  eval("var json=" + data);
                 	  //alert("土豆视频：  "+json.title+" 分享解析成功！");
                 	  $("#previewViedo").append("<Strong>"+json.title+"</Strong><br>");
       				  var single = "{'videoId':"+json.videoId+"}";
       		    	  var source = $("#data-video-hidden").attr("data-video-hidden");  
       		    	  $("#data-video-hidden").attr("data-video-hidden",source + single +","); 
		        });
		  }
		  else if((/\S*youku\S*/g).test(url)){
			  var apiU="https://openapi.youku.com/v2/videos/show_basic.json";
			  $.post("${ctx}/blog/blog.action",{"apiU":apiU,"url":url,"method:saveYoukuVideo":"ok","description":"优酷视频地址的解析"},
			  function(data){
				  $("#video_input").val("");
				  eval("var json=" + data);
				  $("#previewViedo").append("<Strong>"+json.title+"</Strong><br>");
				  var single = "{'videoId':"+json.videoId+"}";
				  var source = $("#data-video-hidden").attr("data-video-hidden");  
   		    	  $("#data-video-hidden").attr("data-video-hidden",source + single +","); 
			  });
		  }
		  else{
			  alert("目前视频只支持土豆和优酷视频");
		  }
	   });
   
   function getTudouData(jsonData){
	   alert(jsonData);
   }

</script>  

<style type="text/css">

#video_input{
  height: 30px;
  width: 70%; 
}

</style>